import { da } from 'element-plus/es/locales.mjs'
import request from '../../../utils/request'
import type { PermisstionResponseData, MenuParams } from './type'
import {} from './type'
enum API {
  GETPERMISSION_URL = '/admin/acl/permission', // 获取菜单
  ADDMENU_URL = '/admin/acl/permission/save', // 新增菜单
  UPDATEMENU_URL = '/admin/acl/permission/update', // 修改菜单
  REMOVEMENU_URL = '/admin/acl/permission/remove/',
}
/* 获取菜单 */
export const reqGetPermission = () =>
  request.get<any, PermisstionResponseData>(API.GETPERMISSION_URL)

/* 添加菜单 */
export const reqAddOrUpdateMenu = (data: MenuParams) => {
  if (data.id) {
    return request.put(API.UPDATEMENU_URL, data)
  } else {
    return request.post(API.ADDMENU_URL, data)
  }
}

/* 删除菜单 */
export const reqDeleteMenu = (Id: number) =>
  request.delete(API.REMOVEMENU_URL + Id)
